<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>桌面歌词</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            background: transparent;
            overflow: hidden;
            user-select: none;
            -webkit-user-select: none;
            -webkit-app-region: drag;
            cursor: move;
        }

        /* 锁定状态下禁用拖拽 */
        body.locked {
            -webkit-app-region: no-drag;
            cursor: default;
        }

        .lyrics-container {
            width: 100%;
            height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            position: relative;
            background: linear-gradient(135deg,
                rgba(0, 0, 0, 0.88) 0%,
                rgba(20, 20, 30, 0.85) 50%,
                rgba(0, 0, 0, 0.82) 100%);
            backdrop-filter: blur(20px) saturate(1.2);
            border-radius: 20px;
            border: 1px solid rgba(255, 255, 255, 0.18);
            box-shadow:
                0 16px 50px rgba(0, 0, 0, 0.5),
                0 4px 20px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
            padding: 24px;
            min-height: 80px;
            box-sizing: border-box;
            max-height: none;
            resize: both;
            overflow: hidden;
        }

        .lyrics-container:hover {
            background: linear-gradient(135deg,
                rgba(0, 0, 0, 0.92) 0%,
                rgba(25, 25, 35, 0.88) 50%,
                rgba(0, 0, 0, 0.85) 100%);
            border-color: rgba(255, 255, 255, 0.25);
            box-shadow:
                0 20px 60px rgba(0, 0, 0, 0.6),
                0 8px 30px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            transform: translateY(-1px);
        }

        .track-info {
            position: absolute;
            top: 12px;
            left: 16px;
            font-size: 11px;
            color: rgba(255, 255, 255, 0.6);
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
            max-width: 60%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .controls {
            position: absolute;
            top: 12px;
            right: 16px;
            display: flex;
            gap: 8px;
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
            -webkit-app-region: no-drag;
        }

        .lyrics-container:hover .controls {
            opacity: 1;
        }

        /* 竖向布局下的控制按钮 */
        .lyrics-container.vertical-layout .controls {
            flex-direction: column;
            top: 16px;
            right: 8px;
            gap: 6px;
        }

        .lyrics-container.vertical-layout .control-btn {
            width: 28px;
            height: 28px;
            font-size: 11px;
        }

        .control-btn {
            width: 32px;
            height: 32px;
            background: rgba(255, 255, 255, 0.12);
            border-radius: 10px;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
            backdrop-filter: blur(15px);
            border: 1px solid rgba(255, 255, 255, 0.08);
            position: relative;
            overflow: hidden;
        }

        .control-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.6s ease;
        }

        .control-btn:hover {
            background: rgba(255, 255, 255, 0.22);
            transform: scale(1.08) translateY(-1px);
            box-shadow:
                0 6px 20px rgba(0, 0, 0, 0.4),
                0 2px 8px rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.2);
        }

        .control-btn:hover::before {
            left: 100%;
        }

        .control-btn:active {
            transform: scale(0.96) translateY(0);
            transition: all 0.1s ease;
        }

        .lyrics-content {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            flex: 1;
            width: 100%;
            max-width: calc(100% - 40px);
            margin: 0 auto;
            transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
        }

        /* 竖向布局模式 */
        .lyrics-container.vertical-layout .lyrics-content {
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 0 5px;
            width: 100%;
            max-width: 100%;
        }

        .lyrics-container.vertical-layout .lyrics-content .current-lyric {
            flex: 1;
            text-align: left;
            margin-bottom: 0;
            margin-right: 15px;
            padding-left: 10px;
        }

        .lyrics-container.vertical-layout .lyrics-content .next-lyric {
            flex: 1;
            text-align: right;
            margin-left: 15px;
            padding-right: 10px;
            transform: translateY(0);
        }

        .current-lyric {
            font-size: 32px;
            font-weight: 700;
            color: #ffffff;
            text-align: center;
            line-height: 1.3;
            text-shadow:
                0 2px 4px rgba(0, 0, 0, 0.8),
                0 4px 12px rgba(0, 0, 0, 0.6),
                0 0 20px rgba(255, 255, 255, 0.1);
            margin-bottom: 16px;
            opacity: 1;
            transform: translateY(0);
            transition: all 0.7s cubic-bezier(0.23, 1, 0.32, 1);
            max-width: 100%;
            word-wrap: break-word;
            word-break: break-word;
            letter-spacing: 0.5px;
            font-family: 'Microsoft YaHei', 'PingFang SC', 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
        }

        /* 竖向布局下的当前歌词样式 */
        .lyrics-container.vertical-layout .current-lyric {
            font-size: 28px;
            line-height: 1.4;
            /* 移除垂直文字模式，改为普通水平文字 */
            writing-mode: initial;
            text-orientation: initial;
            text-align: center;
            max-height: none;
            overflow: visible;
            white-space: normal;
            word-wrap: break-word;
            word-break: break-word;
            /* 确保在极窄窗口下仍然可见 */
            min-width: 0;
            flex-shrink: 1;
        }

        .next-lyric {
            font-size: 20px;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.72);
            text-align: center;
            line-height: 1.4;
            text-shadow:
                0 1px 3px rgba(0, 0, 0, 0.7),
                0 2px 8px rgba(0, 0, 0, 0.4);
            opacity: 0.85;
            transform: translateY(8px);
            transition: all 0.7s cubic-bezier(0.23, 1, 0.32, 1);
            max-width: 100%;
            word-wrap: break-word;
            word-break: break-word;
            letter-spacing: 0.3px;
            font-family: 'Microsoft YaHei', 'PingFang SC', 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
        }

        /* 竖向布局下的下一行歌词样式 */
        .lyrics-container.vertical-layout .next-lyric {
            font-size: 18px;
            line-height: 1.5;
            /* 移除垂直文字模式，改为普通水平文字 */
            writing-mode: initial;
            text-orientation: initial;
            text-align: center;
            max-height: none;
            overflow: visible;
            white-space: normal;
            word-wrap: break-word;
            word-break: break-word;
            opacity: 0.65;
            /* 确保在极窄窗口下仍然可见 */
            min-width: 0;
            flex-shrink: 1;
        }

        .adjustment-panel {
            position: absolute;
            top: 55px;
            right: 16px;
            background: linear-gradient(135deg,
                rgba(15, 15, 25, 0.95) 0%,
                rgba(0, 0, 0, 0.92) 100%);
            border-radius: 16px;
            padding: 20px;
            min-width: 240px;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-15px) scale(0.95);
            transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
            -webkit-app-region: no-drag;
            backdrop-filter: blur(25px) saturate(1.3);
            border: 1px solid rgba(255, 255, 255, 0.18);
            box-shadow:
                0 12px 40px rgba(0, 0, 0, 0.7),
                0 4px 16px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }

        /* 竖向布局下的调整面板 */
        .lyrics-container.vertical-layout .adjustment-panel {
            top: 80px;
            right: 8px;
            min-width: 200px;
            padding: 16px;
        }

        /* 自适应定位的调整面板 */
        .adjustment-panel.position-left {
            left: 16px;
            right: auto;
        }

        .adjustment-panel.position-bottom {
            top: auto;
            bottom: 55px;
        }

        .adjustment-panel.position-center {
            left: 50%;
            right: auto;
            transform: translateX(-50%) translateY(-15px) scale(0.95);
        }

        .adjustment-panel.position-center.show {
            transform: translateX(-50%) translateY(0) scale(1);
        }

        /* 小窗口下的紧凑样式 */
        .adjustment-panel.compact {
            min-width: 180px;
            padding: 12px;
        }

        .adjustment-panel.compact .adjustment-item {
            margin-bottom: 12px;
        }

        .adjustment-panel.compact .adjustment-label {
            font-size: 11px;
            margin-bottom: 6px;
        }

        .adjustment-panel.show {
            opacity: 1;
            visibility: visible;
            transform: translateY(0) scale(1);
        }

        .adjustment-item {
            margin-bottom: 16px;
        }

        .adjustment-item:last-child {
            margin-bottom: 0;
        }

        .adjustment-label {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 8px;
            display: block;
            font-weight: 500;
        }

        .adjustment-slider {
            width: 100%;
            height: 8px;
            border-radius: 4px;
            background: linear-gradient(90deg,
                rgba(255, 255, 255, 0.15) 0%,
                rgba(255, 255, 255, 0.25) 100%);
            outline: none;
            appearance: none;
            cursor: pointer;
            position: relative;
        }

        .adjustment-slider::-webkit-slider-thumb {
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: linear-gradient(135deg,
                #ffffff 0%,
                #f0f0f0 50%,
                #e8e8e8 100%);
            cursor: pointer;
            box-shadow:
                0 4px 12px rgba(0,0,0,.5),
                0 2px 6px rgba(0,0,0,.3),
                inset 0 1px 0 rgba(255,255,255,.3);
            transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
            border: 2px solid rgba(255, 255, 255, 0.8);
        }

        .adjustment-slider::-webkit-slider-thumb:hover {
            transform: scale(1.15);
            box-shadow:
                0 6px 16px rgba(0,0,0,.6),
                0 3px 8px rgba(0,0,0,.4),
                inset 0 1px 0 rgba(255,255,255,.4),
                0 0 0 4px rgba(255, 255, 255, 0.1);
        }

        .adjustment-slider::-webkit-slider-thumb:active {
            transform: scale(1.05);
        }

        .no-lyrics {
            font-size: 20px;
            color: rgba(255, 255, 255, 0.5);
            text-align: center;
            font-style: italic;
        }

        /* 动画效果 */
        @keyframes slideInFromLeft {
            from {
                opacity: 0;
                transform: translateX(-50px) scale(0.95);
                filter: blur(2px);
            }
            to {
                opacity: 1;
                transform: translateX(0) scale(1);
                filter: blur(0);
            }
        }

        @keyframes glow {
            0%, 100% {
                text-shadow:
                    0 2px 4px rgba(0, 0, 0, 0.8),
                    0 4px 12px rgba(0, 0, 0, 0.6),
                    0 0 20px rgba(255, 255, 255, 0.1);
            }
            50% {
                text-shadow:
                    0 2px 4px rgba(0, 0, 0, 0.8),
                    0 4px 12px rgba(0, 0, 0, 0.6),
                    0 0 30px rgba(255, 255, 255, 0.3),
                    0 0 50px rgba(255, 255, 255, 0.1);
            }
        }

        @keyframes backgroundShift {
            0% {
                background: linear-gradient(135deg,
                    rgba(0, 0, 0, 0.88) 0%,
                    rgba(20, 20, 30, 0.85) 50%,
                    rgba(0, 0, 0, 0.82) 100%);
            }
            50% {
                background: linear-gradient(135deg,
                    rgba(10, 10, 20, 0.9) 0%,
                    rgba(25, 25, 35, 0.87) 50%,
                    rgba(5, 5, 15, 0.84) 100%);
            }
            100% {
                background: linear-gradient(135deg,
                    rgba(0, 0, 0, 0.88) 0%,
                    rgba(20, 20, 30, 0.85) 50%,
                    rgba(0, 0, 0, 0.82) 100%);
            }
        }

        @keyframes pulse {
            0%, 100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.02);
            }
        }

        .lyric-enter {
            animation: slideInFromLeft 0.9s cubic-bezier(0.23, 1, 0.32, 1);
        }

        .current-lyric.highlight {
            animation: glow 4s ease-in-out infinite;
        }

        .lyrics-container.playing {
            animation: backgroundShift 12s ease-in-out infinite;
        }

        .lyrics-container.playing .current-lyric {
            animation: pulse 6s ease-in-out infinite;
        }

        /* 布局切换过渡动画 */
        .layout-transitioning {
            transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1) !important;
        }

        .layout-transitioning .current-lyric,
        .layout-transitioning .next-lyric {
            transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1) !important;
        }

        /* 主题样式 */
        .theme-blue .current-lyric {
            color: #64b5f6;
            text-shadow:
                0 2px 4px rgba(0, 0, 0, 0.8),
                0 4px 12px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(100, 181, 246, 0.5),
                0 0 60px rgba(100, 181, 246, 0.2);
        }

        .theme-blue .lyrics-container {
            border-color: rgba(100, 181, 246, 0.3);
        }

        .theme-green .current-lyric {
            color: #81c784;
            text-shadow:
                0 2px 4px rgba(0, 0, 0, 0.8),
                0 4px 12px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(129, 199, 132, 0.5),
                0 0 60px rgba(129, 199, 132, 0.2);
        }

        .theme-green .lyrics-container {
            border-color: rgba(129, 199, 132, 0.3);
        }

        .theme-purple .current-lyric {
            color: #ba68c8;
            text-shadow:
                0 2px 4px rgba(0, 0, 0, 0.8),
                0 4px 12px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(186, 104, 200, 0.5),
                0 0 60px rgba(186, 104, 200, 0.2);
        }

        .theme-purple .lyrics-container {
            border-color: rgba(186, 104, 200, 0.3);
        }

        .theme-orange .current-lyric {
            color: #ffb74d;
            text-shadow:
                0 2px 4px rgba(0, 0, 0, 0.8),
                0 4px 12px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(255, 183, 77, 0.5),
                0 0 60px rgba(255, 183, 77, 0.2);
        }

        .theme-orange .lyrics-container {
            border-color: rgba(255, 183, 77, 0.3);
        }

        .theme-pink .current-lyric {
            color: #f48fb1;
            text-shadow:
                0 2px 4px rgba(0, 0, 0, 0.8),
                0 4px 12px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(244, 143, 177, 0.5),
                0 0 60px rgba(244, 143, 177, 0.2);
        }

        .theme-pink .lyrics-container {
            border-color: rgba(244, 143, 177, 0.3);
        }

        .theme-cyan .current-lyric {
            color: #4dd0e1;
            text-shadow:
                0 2px 4px rgba(0, 0, 0, 0.8),
                0 4px 12px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(77, 208, 225, 0.5),
                0 0 60px rgba(77, 208, 225, 0.2);
        }

        .theme-cyan .lyrics-container {
            border-color: rgba(77, 208, 225, 0.3);
        }

        /* 响应式设计 */
        @media (max-width: 600px) {
            .current-lyric {
                font-size: 24px;
            }

            .next-lyric {
                font-size: 16px;
            }
        }

        /* 自适应布局检测 - 当高度大于等于宽度时的额外样式 */
        @media (max-aspect-ratio: 1/1) {
            .lyrics-container:not(.force-horizontal) {
                /* 这里可以添加一些基础的竖向布局样式 */
            }

            .lyrics-container:not(.force-horizontal) .track-info {
                writing-mode: vertical-rl;
                text-orientation: mixed;
                top: 16px;
                left: 12px;
                max-width: none;
                max-height: 40%;
            }
        }

        /* 强制横向布局模式 */
        .lyrics-container.force-horizontal .lyrics-content {
            flex-direction: column !important;
        }

        .lyrics-container.force-horizontal .current-lyric,
        .lyrics-container.force-horizontal .next-lyric {
            writing-mode: initial !important;
            text-orientation: initial !important;
            text-align: center !important;
        }
    </style>
</head>
<body>
    <div class="lyrics-container" id="lyricsContainer">
        <div class="track-info" id="trackInfo">
            MusicBox 桌面歌词
        </div>
        
        <div class="controls">
            <button class="control-btn" id="lockBtn" title="锁定位置">🔒</button>
            <button class="control-btn" id="settingsBtn" title="设置">⚙</button>
            <button class="control-btn" id="closeBtn" title="关闭">✕</button>
        </div>

        <!-- 调整面板 -->
        <div class="adjustment-panel" id="adjustmentPanel">
            <div class="adjustment-item">
                <label class="adjustment-label">透明度</label>
                <input type="range" class="adjustment-slider" id="opacitySlider" min="0.3" max="1" step="0.1" value="0.8">
            </div>
            <div class="adjustment-item">
                <label class="adjustment-label">字体大小</label>
                <input type="range" class="adjustment-slider" id="fontSizeSlider" min="20" max="40" step="2" value="28">
            </div>
        </div>

        <div class="lyrics-content">
            <div class="current-lyric" id="currentLyric">
                等待歌词加载...
            </div>

            <div class="next-lyric" id="nextLyric">

            </div>
        </div>
    </div>

    <script src="js/cache-manager.js"></script>
    <script src="js/desktop-lyrics.js"></script>
</body>
</html>
